#coding:utf-8
'''
Created on 2015-11-20

@author: root
'''
from __future__ import absolute_import
from app import app
from datetime import timedelta
from kombu import Exchange,Queue

BROKER_URL = app.config.get("REDIS_URL")

CELERY_TIMEZONE = 'Asia/Shanghai'
CELERYD_MAX_TASKS_PER_CHILD = 100
CELERYD_CONCURRENCY = 1

PERIODIC_NOTIFY_TIMEDELTA = {1:15,2:15,3:30,4:180,5:1800,6:1800,7:1800,8:1800,9:3600}
MEDIA_PATH = "/data/media/"


TASK_TIME_DELTA = 3600*10
VIDEO_CHANNEL = 1 #1、UC 2、xwtt


CELERY_QUEUES = (
Queue("default",Exchange("default"),routing_key="default"),
Queue("for_upload",Exchange("for_upload"),routing_key="for_upload"),
Queue("for_download",Exchange("for_download"),routing_key="for_download"),
)

# CELERY_ROUTES = {
# 'celery_proj.tasks.upload_video':{"queue":"for_upload","routing_key":"for_upload"},
# 'celery_proj.tasks.upload_video_scheduler':{"queue":"for_upload","routing_key":"for_upload"},
# 'celery_proj.tasks.analysis_path':{"queue":"for_download","routing_key":"for_download"},
# 'celery_proj.tasks.analysis_path_qtt':{"queue":"for_download","routing_key":"for_download"},
# 'celery_proj.dlsdk.kuai.analysis_path_kuai':{"queue":"for_kuai_download","routing_key":"for_kuai_download"},
# 'celery_proj.tasks.download_video_scheduler':{"queue":"for_download","routing_key":"for_download"},
# }

CELERYBEAT_SCHEDULE = {
    # Executes every Monday morning at 7:30 A.M
#     'catch_baomihua_video': {
#         'task': 'celery_proj.tasks.baomihua',#定时抓取爆米花视频
#         'schedule': timedelta(seconds=TASK_TIME_DELTA),
#         'args': (),
#     },
#     'catch_lsp_video': {
#         'task': 'celery_proj.tasks.livideo',#定时抓取梨视频
#         'schedule': timedelta(seconds=TASK_TIME_DELTA),
#         'args': (),
#     },
#     'catch_kuran_video': {
#         'task': 'celery_proj.tasks.kuran',#定时抓取酷然视频
#         'schedule': timedelta(seconds=TASK_TIME_DELTA),
#         'args': (),
#     },
#     'catch_wangyi_video': {
#         'task': 'celery_proj.tasks.wangyi',#定时抓取网易视频
#         'schedule': timedelta(seconds=TASK_TIME_DELTA),
#         'args': (),
#     },
#     'catch_qtt_video': {
#         'task': 'celery_proj.tasks.qtt',#定时抓取趣头条视频
#         'schedule': timedelta(seconds=120),
#         'args': (),
#     },
    'catch_qtt_video':{
        'task': 'celery_pro.tasks.catch_author_info',#定时下载UC头条视频
        'schedule': timedelta(seconds=5),
        'args': (),
    },
    'catch_qtt_video1':{
        'task': 'celery_pro.tasks.catch_author_info1',#定时下载UC头条视频
        'schedule': timedelta(seconds=5),
        'args': (),
    },
    'catch_qtt_video2':{
        'task': 'celery_pro.tasks.catch_author_info2',#定时下载UC头条视频
        'schedule': timedelta(seconds=5),
        'args': (),
    },
    'catch_qtt_video3':{
        'task': 'celery_pro.tasks.catch_author_info3',#定时下载UC头条视频
        'schedule': timedelta(seconds=5),
        'args': (),
    },
    'catch_qtt_video4':{
        'task': 'celery_pro.tasks.catch_author_info4',#定时下载UC头条视频
        'schedule': timedelta(seconds=5),
        'args': (),
    },
    'catch_qtt_video5':{
        'task': 'celery_pro.tasks.catch_author_info5',#定时下载UC头条视频
        'schedule': timedelta(seconds=5),
        'args': (),
    },
}